import { defineConfig } from 'vite'
import path, { resolve } from 'path';
import vue from '@vitejs/plugin-vue'
const pathResolve = (dir) => {
  return resolve(__dirname, '.', dir)
}
export default defineConfig({
  base: '/async/',
  server: {
    hmr: true
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: `@use "./src/pages/editor/styles/element/index.scss" as *;`,
      },
    },
  },
  resolve: {
    alias: {
      '@': path.join(__dirname, './src'),
      '/@': pathResolve('./src/'),
      'vue': 'https://6c6f-lowcode-2gxh0baw4d19d595-1256670128.tcb.qcloud.la/assets/vue.esm.js',
    }
  },
  plugins: [
    vue(),
    {
      enforce: 'post',
      apply: 'build'
    }
  ],
  build: {
    rollupOptions: {
      input: {
        editor: resolve(__dirname, 'src/pages/editor/index.html'),
        preview: resolve(__dirname, 'src/pages/preview/index.html'),
      }
    }
  }
})
